package com.jd.system.service.impl;

import com.jd.basic.util.PageList;
import com.jd.system.domain.Dictionarydetail;
import com.jd.system.mapper.DictionarydetailMapper;
import com.jd.system.query.DictionarydetailQuery;
import com.jd.system.service.IDictionarydetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class DictionarydetailServiceImpl implements IDictionarydetailService {

    @Autowired
    private DictionarydetailMapper dictionarydetailMapper;



    @Override
    @Transactional
    public void save(Dictionarydetail dictionarydetail) {
        dictionarydetailMapper.save(dictionarydetail);
    }

    @Override
    @Transactional
    public void remove(Long id) {
        dictionarydetailMapper.remove(id);
    }

    @Override
    @Transactional
    public void update(Dictionarydetail dictionarydetail) {
        dictionarydetailMapper.update(dictionarydetail);
    }

    @Override
    public Dictionarydetail loadById(Long id) {
        return dictionarydetailMapper.loadById(id);
    }

    @Override
    public List<Dictionarydetail> loadAll() {
        return dictionarydetailMapper.loadAll();
    }

    @Override
    public PageList<Dictionarydetail> queryPage(DictionarydetailQuery dictionarydetailQuery) {
        // 查询总条数
        Integer totals = dictionarydetailMapper.queryPage(dictionarydetailQuery);
        if (totals == 0){
            return new PageList<>();
        }
        // 分页查询
        List<Dictionarydetail> data = dictionarydetailMapper.queryData(dictionarydetailQuery);
        return new PageList<>(data,totals);

    }

    @Override
    public void patchRemove(List<Long> ids) {
        dictionarydetailMapper.patchRemove(ids);
    }




}
